package com.howso.cloud.feign.fallback;

import com.howso.cloud.feign.HowsoMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

/**
 * menuService降级工场
 *
 */
@Slf4j
@Component
public class HowsoMenuServiceFallbackFactory implements FallbackFactory<HowsoMenuService> {

    @Override
    public HowsoMenuService create(Throwable cause) {
        return () -> {
            log.error("调用findMenus异常：{}", cause);
            return new ArrayList<>();
        };
    }
}
